import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class MovieTest {
    @Test
    void testConstructor() {
        Movie movie = new Movie("MOVIE001", "测试电影", "测试导演", "测试演员", "测试简介", 120, 8.5);
        assertEquals("MOVIE001", movie.getMovieId());
        assertEquals("测试电影", movie.getTitle());
        assertEquals("测试导演", movie.getDirector());
        assertEquals("测试演员", movie.getActors());
        assertEquals("测试简介", movie.getIntro());
        assertEquals(120, movie.getDuration());
        assertEquals(8.5, movie.getScore());
    }
    // 测试 Getter/Setter 方法
    @Test
    void testGetterSetter() {
        Movie movie = new Movie("MOVIE001", "初始标题", "初始导演", "初始演员", "初始简介", 90, 7.0);
        // 测试 title
        movie.setTitle("新标题");
        assertEquals("新标题", movie.getTitle());
        // 测试 director
        movie.setDirector("新导演");
        assertEquals("新导演", movie.getDirector());
        // 测试其他属性
        movie.setActors("新演员");
        assertEquals("新演员", movie.getActors());
        movie.setIntro("新简介");
        assertEquals("新简介", movie.getIntro());
        movie.setDuration(150);
        assertEquals(150, movie.getDuration());
        movie.setScore(8.0);
        assertEquals(8.0, movie.getScore());
    }
    // 测试 toString 方法
    @Test
    void testToString() {
        Movie movie = new Movie("MOVIE001", "测试电影", "测试导演", "测试演员", "测试简介", 120, 8.5);
        String expected = "Movie{movieId='MOVIE001', title='测试电影', director='测试导演' ...}";
        String actual = movie.toString();
        // 简单验证关键属性是否包含
        assertTrue(actual.contains("MOVIE001"));
        assertTrue(actual.contains("测试电影"));
    }
    // 测试 setInfo 方法
    @Test
    void testSetInfo() {
        Movie movie = new Movie("MOVIE001", "初始标题", "初始导演", "初始演员", "初始简介", 90, 7.0);
        // 批量更新信息
        movie.setInfo("新导演", "新演员", "新简介", 120, 8.0);
        // 验证更新后的值
        assertEquals("新导演", movie.getDirector());
        assertEquals("新演员", movie.getActors());
        assertEquals("新简介", movie.getIntro());
        assertEquals(120, movie.getDuration());
        assertEquals(8.0, movie.getScore());
    }
}

